<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /* var a=new Function("a","b","alert(a+b)");
            a(3,4); */
        /* function fun2(a,b){
            alert(a+b)
        }
        fun2(3,4) */
        /* var fun3 = function (a, b) {
            alert(a + b)
        }
        fun3(3, 4) */

        /* function add(a, b) {
            return a + b;
        }
        var sum = add(1, 2)
        alert(sum); */
        function add() {
            var sum = 0;
            for (let i = 0; i < arguments.length; i++) {
                sum += arguments[i];
            }
            return sum;
        }
        var sum = add(1, 2, 3)
        alert(sum);
    </script>
</body>

</html>